package com.zcxx.cotton.pick.service.impl;

import java.time.Year;
import java.util.List;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zcxx.cotton.pick.mapper.PickMapInfoMapper;
import com.zcxx.cotton.pick.domain.PickMapInfo;
import com.zcxx.cotton.pick.service.IPickMapInfoService;


/**
 * 地图信息Service业务层处理
 *
 * @author ruoyi
 * @date 2021-05-06
 */
@Service
public class PickMapInfoServiceImpl extends ServiceImpl<PickMapInfoMapper,PickMapInfo> implements IPickMapInfoService
{
    @Autowired
    private PickMapInfoMapper pickMapInfoMapper;

    /**
     * 查询地图信息
     *
     * @param mapInfoId 地图信息ID
     * @return 地图信息
     */
    @Override
    public PickMapInfo selectPickMapInfoById(Long mapInfoId)
    {
        return pickMapInfoMapper.selectPickMapInfoById(mapInfoId);
    }

    /**
     * 查询地图信息列表
     *
     * @param pickMapInfo 地图信息
     * @return 地图信息
     */
    @Override
    public List<PickMapInfo> selectPickMapInfoList(PickMapInfo pickMapInfo)
    {
        /*Year year = Year.now();
        String yearStr=year.toString();
        String tbName= "pick_map_info";
        if(pickMapInfo.getDeviceMainCode()==null) {
            tbName= "pick_map_info";
        }else {
            tbName = "pick_map_info_" + pickMapInfo.getDeviceMainCode() +"_"+ yearStr;
        }*/

        String tbName= "pick_map_info";
        pickMapInfo.setTbName(tbName);
        return pickMapInfoMapper.selectPickMapInfoList(pickMapInfo);
    }

    /**
     * 新增地图信息
     *
     * @param pickMapInfo 地图信息
     * @return 结果
     */
    @Override
    public int insertPickMapInfo(PickMapInfo pickMapInfo)
    {

        return pickMapInfoMapper.insertPickMapInfo(pickMapInfo);
    }

    /**
     * 修改地图信息
     *
     * @param pickMapInfo 地图信息
     * @return 结果
     */
    @Override
    public int updatePickMapInfo(PickMapInfo pickMapInfo)
    {

        return pickMapInfoMapper.updatePickMapInfo(pickMapInfo);
    }

    /**
     * 删除地图信息对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deletePickMapInfoByIds(String ids)
    {
        return pickMapInfoMapper.deletePickMapInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除地图信息信息
     *
     * @param mapInfoId 地图信息ID
     * @return 结果
     */
    @Override
    public int deletePickMapInfoById(Long mapInfoId)
    {
        return pickMapInfoMapper.deletePickMapInfoById(mapInfoId);
    }

    @Override
    public void createTable(String tbName) {
         pickMapInfoMapper.createTable(tbName);
    }
}
